* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --primary-hover: #4338CA;
    --success-color: #10B981;
    --success-hover: #059669;
    --danger-color: #EF4444;
    --secondary-color: #6B7280;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}


/* Header */

header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), #7C3AED);
    color: white;
    border-radius: 16px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}


/* Main sections */

main {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    /* 移除overflow限制，让内容可以自然展开 */
    overflow: visible;
}

section h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}


/* Drop Zone */

.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary-color);
    stroke-width: 2;
}

.drop-zone h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.drop-zone p {
    color: var(--text-secondary);
}


/* File List */

.file-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: move;
}

.file-item:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

.file-item.dragging {
    opacity: 0.5;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.file-icon {
    font-size: 24px;
}

.file-details {
    display: flex;
    flex-direction: column;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background: var(--bg-color);
}


/* Layout Options */

.layout-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.radio-group {
    display: flex;
    gap: 10px;
}

.radio-option {
    cursor: pointer;
    flex: 1;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.radio-option input[type="radio"]:checked+.radio-card {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.radio-card:hover {
    border-color: var(--primary-color);
}

.orientation-icon {
    width: 32px;
    height: 32px;
    stroke-width: 2;
}

.number-input {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
}

.number-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.select-input {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: white;
    cursor: pointer;
    width: 100%;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.select-input:hover {
    border-color: var(--primary-color);
}

.layout-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.preset-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.preset-btn:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.preset-btn:active {
    transform: translateY(0);
}

.preset-preview {
    width: 100%;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 4px;
}

.preset-btn span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.layout-option {
    cursor: pointer;
}

.layout-option input[type="radio"] {
    display: none;
}

.option-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.layout-option input[type="radio"]:checked+.option-card {
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.05);
}

.option-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.layout-preview {
    display: grid;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 80px;
    align-items: center;
}

.layout-2 {
    grid-template-columns: 1fr 1fr;
}

.layout-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.layout-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.preview-box {
    aspect-ratio: 1;
    background: var(--border-color);
    border-radius: 4px;
}

.option-card span {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
}


/* Buttons */

.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

button {
    font-family: inherit;
    font-size: 1rem;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4B5563;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}


/* Progress */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}


/* Preview */

.preview-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 移除固定高度限制，让内容自然展开 */
    max-height: none;
    overflow-y: visible;
    padding: 10px;
}

.preview-page {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: white;
    padding: 10px;
    /* 居中显示 */
    margin: 0 auto;
}

.preview-page-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-align: center;
}

.preview-page canvas {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* 移除滚动相关的样式 */
/*
.preview-container::-webkit-scrollbar {
    width: 8px;
}

.preview-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}
*/

/* 移除滚动提示样式 */
/*
.preview-container:hover {
    border-left: 3px solid var(--primary-color) !important;
    border-right: 3px solid var(--primary-color) !important;
}

.scrollable-preview {
    border-left: 3px solid var(--primary-color);
    border-right: 3px solid var(--primary-color);
}
*/

/* Footer */

footer {
    margin-top: 60px;
    padding: 40px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.feature-icon {
    font-size: 2rem;
    line-height: 1;
}

.feature h4 {
    margin-bottom: 5px;
    color: var(--text-primary);
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}


/* Responsive */

@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    section {
        padding: 20px;
    }
    .layout-options {
        grid-template-columns: 1fr;
    }
    .action-buttons {
        flex-direction: column;
    }
    button {
        width: 100%;
    }
}